from core.basehandler import BaseHandler
from core.room import Room
from core.support import set_cutscene
from core.action import Action

class river4(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        self.village_undiscovered = True
           
        # build list of actions
        self.add_action(Out)
        self.add_action(Down)
        self.add_action(Up)
    
    # return description of room.
    def get_description(self):
        return "After walking for a few more hours, you notice something in the distance, off of the path."
    
    # return image of room
    def get_image(self):
        if self.village_undiscovered:
            return 'river4.JPG'
        else:
            return 'zulu_warriors.jpg'

class River4Handler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return river4

# define actions for this room

class Out(Action):
    def __init__(self):
        Action.__init__(self, "Out")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Walk toward the Lodge"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'river3'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class Down(Action):
    def __init__(self):
        Action.__init__(self, "Down")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Continue along the river path"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'river5'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"
  
    
class Up(Action):
    def __init__(self):
        Action.__init__(self, "Up")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Stray from the path"
    
    def get_destination(self):
        if self.room.village_undiscovered:
            return 'river4'
        else:
            return 'death'
    
    def do_action(self,game,room,request):
        if self.room.village_undiscovered:
            set_cutscene("Didn't your mother teach you not to walk blindly on the plains of Africa?")
        return
    
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"